package com.team.dutchboy.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.team.dutchboy.entity.OauthCode;
import com.team.dutchboy.mapper.OauthCodeMapper;
import com.team.dutchboy.service.FeignDemo;
import com.team.dutchboy.service.OauthCodeService;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Slf4j
@Transactional
public class SeataTestImpl extends ServiceImpl<OauthCodeMapper,OauthCode> implements OauthCodeService {

    @Autowired
    private FeignDemo feignDemo;

    @GlobalTransactional
    @Override
    public void insert() {
        OauthCode oauthCode = new OauthCode();
        oauthCode.setCode("1");
        oauthCode.setAuthentication("dutchboy插入");
        insert(oauthCode);
        String s = feignDemo.testSeata("a");
        log.info("dfds");
    }
}
